.top-bar {
    background: #27548A;
    color: white;
    font-size: var(--font-size-small);
    padding: var(--spacing-xs) 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1001;
    width: 100%;
    margin: 0;
    line-height: 1.7;
    height: auto;
}

.top-bar-container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 var(--container-padding);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar {
    position: fixed;
    top: 40px;
    left: 0;
    right: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    z-index: 1000;
    padding: var(--spacing-md) 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.08);
}

.nav-container {
    max-width: var(--container-max-width);
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 var(--container-padding);
    height: 50px;
    position: relative;
}

.logo {
    display: flex;
    align-items: center;
    font-family: var(--font-display);
    font-size: var(--font-size-h4);
    font-weight: var(--font-weight-bold);
    color: #27548A;
    text-decoration: none;
    transition: transform 0.2s ease;
}

.logo:hover {
    transform: translateY(-1px);
}

.logo-icon {
    background-image: url("../../images/bvuedulogo_only.png");
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    flex-shrink: 0;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    height: 100%;
}

.nav-links > li {
    display: flex;
    align-items: center;
    height: 100%;
}

.nav-links a {
    color: #333;
    font-family: var(--font-primary);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-base);
    padding: 0.75rem 0;
    position: relative;
    text-decoration: none;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    height: 100%;
    white-space: nowrap;
}

.nav-links a.active,
.nav-links a:hover {
    color: #2563eb;
}

.nav-links a.active::after,
.nav-links a:hover::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: #2563eb;
    transform: scaleX(1);
    transition: transform 0.3s ease;
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: #2563eb;
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.mobile-menu-btn {
    display: none;
    font-size: 1.5rem;
    color: #333;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.3s ease;
}

.mobile-menu-btn:hover {
    color: #2563eb;
}

.nav-links li.dropdown {
    position: relative;
}

.nav-links li.dropdown > a.dropbtn {
    cursor: pointer !important;
    display: inline-flex !important;
    align-items: center !important;
    color: #333;
    font-weight: 500;
    padding: 0.75rem 0;
    font-family: inherit;
    font-size: 1rem;
    text-decoration: none;
    user-select: none;
    transition: color 0.3s ease;
    height: 100%;
    position: relative;
}

.nav-links li.dropdown > a.dropbtn .arrow {
    margin-left: 0.4rem !important;
    transition: transform 0.2s ease !important;
    display: inline-block !important;
    font-size: 0.75em !important;
    color: inherit !important;
}

.nav-links li.dropdown:hover > a.dropbtn .arrow {
    transform: rotate(180deg) !important;
}

.nav-links li.dropdown:hover > a.dropbtn,
.nav-links li.dropdown:focus-within > a.dropbtn {
    color: #2563eb;
}

.nav-links ul.dropdown-content {
    position: absolute;
    top: 100%;
    left: 0;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(22px);
    min-width: 200px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    padding: 0.5rem 0;
    margin: 0;
    list-style: none;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    z-index: 1001;
    visibility: hidden;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.15s ease;
    pointer-events: none;
}

.nav-links li.dropdown:hover > ul.dropdown-content {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.nav-links li.dropdown::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 5px;
    background: transparent;
    z-index: 1000;
}

.nav-links ul.dropdown-content li {
    margin: 0;
    padding: 0;
}

.nav-links ul.dropdown-content li a {
    color: #333;
    font-weight: 500;
    padding: 0.75rem 1.25rem;
    text-decoration: none;
    display: block;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s ease;
    white-space: nowrap;
    border-radius: 0;
    margin: 0;
    position: relative;
}

.nav-links ul.dropdown-content li a::after {
    display: none;
}

.nav-links ul.dropdown-content li a:hover,
.nav-links ul.dropdown-content li a:focus {
    color: #2563eb;
    background-color: rgba(37, 99, 235, 0.08);
    outline: none;
}

.navbar .btn--cta {
    background-color: #3b82f6;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    font-family: var(--font-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.navbar .btn--cta:hover {
    background-color: #2563eb;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

body {
    padding-top: 110px !important;
}

@media (max-width: 768px) {
    .nav-container {
        padding: 1.5rem 1rem 0rem 1rem;
        height: auto;
        justify-content: space-between;
        align-items: center;
    }
    
    .nav-links {
        position: absolute;
        align-items: center;
        justify-content: center;
        top: 100%;
        left: 0;
        right: 0;
        background: white;
        padding: 1rem 1.5rem 0rem 1.5rem;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        border-radius: 0 0 15px 15px;
        transform: translateY(-8px);
        opacity: 0;
        visibility: hidden;
        transition: all 0.1s ease;
        z-index: 1000;
        gap: 25px;
    }
    
    .nav-links.mobile-menu-open {
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
        max-width: fit-content;
    }
    
    .nav-links li {
        width: 100%;
        text-align: left;
        padding-bottom: 0.5rem;
        margin-bottom: 0.5rem;
        background-color: white;
    }
    
    .mobile-menu-btn {
        display: block;
    }
    
    .btn--cta {
        order: -1;
    }
    
    .dropdown-content {
        position: static;
        display: none;
        box-shadow: none;
        background: #f8f9fa;
        margin-top: 0.5rem;
        border-radius: 8px;
        padding: 0.5rem 0;
    }
    
    .dropdown-content li {
        border-bottom: none;
        margin-bottom: 0.5rem;
        padding-bottom: 0;
    }
    
    .dropdown-content a {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
        color: #666;
    }
    .nav-links .dropdown .dropdown-content {
    position: absolute;
    display: none;             /* closed by default */
    box-shadow: none;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 0.5rem 0;
  }

  .nav-links .dropdown.open > .dropdown-content {
    display: block;
  }
.nav-links li.dropdown:hover > a.dropbtn .arrow {
    transform: rotate(0deg) !important;
}

  .nav-links .dropdown > .dropbtn {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }
}

@media (max-width: 640px) {
    .top-bar-container {
        padding: 0 1rem;
    }
    
}

/* --- Mobile overflow fix for top bar + navbar --- */

/* Never let the page scroll sideways */
html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Make width calculations include padding/border */
*, *::before, *::after { box-sizing: border-box; }

/* These are fixed headers — make sure they don't exceed the viewport */
.top-bar,
.navbar {
  width: 100%;            /* avoid 100vw */
  left: 0;
  right: 0;
}

/* Their inner flex rows must be allowed to shrink instead of overflowing */
.top-bar-container,
.nav-container {
  max-width: 100%;
  min-width: 0;           /* allow flex children to shrink */
  overflow-x: hidden;     /* clip any sub-pixel overflow from shadows, etc. */
}

/* Flex children: allow wrapping/shrinking */
.top-bar-left,
.top-bar-right {
  min-width: 0;           /* critical to prevent flex overflow */
}
.top-bar-right {
  white-space: nowrap;    /* optional: keep the “Socials” text on one line */
}

/* Mobile dropdown container should never be wider than the navbar */
@media (max-width: 768px) {
  .nav-links {
    width: 100%;
    max-width: 100%;
    left: 0;
    right: 0;
  }
}

/* Defensive: any element in headers using 100vw becomes 100% instead */
.top-bar [style*="100vw"],
.navbar [style*="100vw"] {
  width: 100% !important;
}

/* === FIX: don't clip the mobile drawer === */
.top-bar-container,
.nav-container {
  overflow: visible !important;   /* let the dropdown render below the bar */
  min-width: 0;                   /* keep the shrink fix */
}

/* keep the no-sideways-scroll, but don't block the drawer */
html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;             /* fine to keep */
}

/* headers should not exceed viewport */
.top-bar,
.navbar {
  width: 100%;
  left: 0;
  right: 0;
}

/* dropdown panel should never be wider than the bar */
@media (max-width: 768px) {
  .nav-links {
    width: 100%;
    max-width: 100%;
    left: 0;
    right: 0;
    z-index: 2000;                /* stay above content */
  }
}

/* optional: constrain over-wide inline styles that use 100vw */
.top-bar [style*="100vw"],
.navbar [style*="100vw"] { width: 100% !important; }
